//
//  CWSocketByStream.h
//  paytong
//
//  Created by 王 友宏 on 10-12-30.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@class CWUserRegisterInfo;
@class CWOrderInfo;

@interface CWSocketByStream : NSObject <NSStreamDelegate> {
	NSInputStream *inputStream;
	NSOutputStream *outputStream;
	NSMutableData *recvData;
	NSMutableData *sendData;
	int sendPtr;
	bool isConnected;
	bool isSending;
}

@property bool isConnected;

-(void)createStream:(NSString *)serverIP serverPort:(UInt32)serverPort;

-(void)sendData:(NSString *)sendContext;
-(void)sendRegister:(CWUserRegisterInfo *)urInfo;						//发送注册信息包
-(void)sendLogin:(NSString *)userName password:(NSString *)password;	//发送登录包
-(void)sendLogout;	//发送断开包
-(void)sendOrder1:(CWOrderInfo *)odInfo;	//发送订单程票
-(void)sendOrder2:(CWOrderInfo *)odInfo;	//发送订双程票
-(void)sendPay:(NSString *)userName cardLast6:(NSString *)cardLast6 payPassword:(NSString *)payPassword orderNo:(NSString *)orderNo amount:(NSString *)amount;	//发送支付信息包
-(void)sendLGPawword:(NSString *)userName oldPassword:(NSString *)oldPassword newPassword:(NSString *)newPassword;	//发送修改登录密码包
-(void)sendPayPassword:(NSString *)userName oldPassword:(NSString *)oldPassword newPassword:(NSString *)newPassword;	//发送修改支付密码包
-(void)sendAddCard:(NSString *)userName IDNo:(NSString *)IDNo cardNo:(NSString *)cardNo bank:(NSString *)bank bankAddress:(NSString *)bankAddress;		//发送增加银行卡信息包
-(void)sendInfo:(NSString *)userName email:(NSString *)email mobil:(NSString *)mobil phone:(NSString *)phone address:(NSString *)address code:(NSString *)code;		//发送修改个人信息包

+(NSString *)getSub:(NSString *)mainStr fromStr:(NSString *)fromStr toStr:(NSString *)toStr;

@end
